package com.vodone.v1pin.component.linklabel
{
	import flash.display.GradientType;
	import flash.events.MouseEvent;
	import flash.geom.Matrix;
	
	import mx.controls.TextInput;
	
	public class MyTextInput extends TextInput
	{
		public var matr:Matrix;
		public function MyTextInput()
		{
			super();
			matr = new Matrix();
			
			this.addEventListener(MouseEvent.ROLL_OVER , overHandler );
			this.addEventListener(MouseEvent.ROLL_OUT , outHandler );
			this.setStyle("borderColor",0xBFBEBB);
			this.setStyle("backgroundAlpha",0);
			this.setStyle("borderThickness",0);
			this.setStyle("borderStyle","none");
			
		}
		
		
		private var isOver:Boolean = false;
		protected function overHandler( event:MouseEvent ):void
		{
//			this.setStyle("backgroundColor",0xfefefe);
			isOver = true;
			this.invalidateDisplayList();
		}
		
		protected function outHandler( event:MouseEvent ):void
		{
//			this.setStyle("backgroundColor",0xffffff);
			isOver = false;
			this.invalidateDisplayList();
		}
		
		
		protected override function updateDisplayList(w:Number, h:Number):void
		{
			
			
			super.updateDisplayList( w ,h );
			this.graphics.clear();
			this.graphics.lineStyle(1,0xBFBEBB);
			matr.createGradientBox(w, h, 90 * Math.PI / 180);
			if( isOver ){
				this.graphics.beginGradientFill(GradientType.LINEAR, [0xECE7DA,0xF4F1E6],[1,1],[1,70],matr);
			}else{
				this.graphics.beginGradientFill(GradientType.LINEAR, [0xE3DCCA,0xF0EBDC],[1,1],[1,155],matr);
			}
			this.graphics.drawRoundRect(0,0,w,h,5,5);
			this.graphics.endFill();
		}
	}
}